<!DOCTYPE HTML>
<html>
<head>
<!--jQuery dependencies-->
    <link rel="stylesheet" href="../../pqgrid/css/jquery-ui-base-1.9.1.css" />
    <script src="../../pqgrid/js/jquery-1.9.1.min.js"></script>    
    <script src="../../pqgrid/js/jquery-ui-1.9.2.min.js"></script>
<!--PQ Grid files-->
    <link rel="stylesheet" href="../../pqgrid/pqgrid.min.css" />
    <script src="../../pqgrid/pqgrid.min.js"></script>
<!--PQ Grid Office theme-->
    <link rel="stylesheet" href="../../pqgrid/themes/office/pqgrid.css" />

<script>
    $(function () {
        var data = [[1, 'Exxon Mobil', '339938.0', '36130.0'],
            [2, 'Wal-Mart Stores', '315654.0', '11231.0'],
			[3, 'Royal Dutch Shell', '306731.0', '25311.0'],
			[4, 'BP', '267600.0', '22341.0'],
			[5, 'General Motors', '192604.0', '-10567.0'],
			[6, 'Chevron', '189481.0', '14099.0'],
			[7, 'DaimlerChrysler', '186106.3', '3536.3'],
			[8, 'Toyota Motor', '185805.0', '12119.6'],
			[9, 'Ford Motor', '177210.0', '2024.0'],
			[10, 'ConocoPhillips', '166683.0', '13529.0'],
			[11, 'General Electric', '157153.0', '16353.0'],
			[12, 'Total', '152360.7', '15250.0'],
			[13, 'ING Group', '138235.3', '8958.9'],
			[14, 'Citigroup', '131045.0', '24589.0'],
			[15, 'AXA', '129839.2', '5186.5'],
			[16, 'Allianz', '121406.0', '5442.4'],
			[17, 'Volkswagen', '118376.6', '1391.7'],
			[18, 'Fortis', '112351.4', '4896.3'],
			[19, 'Crédit Agricole', '110764.6', '7434.3'],
			[20, 'American Intl. Group', '108905.0', '10477.0']
        ];

        var obj = {
            width: "auto", //auto width
            height: "100%-2", //height in %age
            selectionModel: { type: 'cell' },
            autoSizeInterval: 0,
            scrollModel: { autoFit: true },
            dragColumns: {enabled: false},
            //showTop: false,
            showBottom: false
        };
        obj.columnTemplate = {
            width: '25%', //column width in %age
            editor: { style: 'z-index:10000;position:relative;' }
        };
        obj.colModel = [{ title: "Rank", dataType: 'integer' },
            { title: "Company", dataType: 'string', width:200 },
            { title: "Revenues ($ millions)", dataType: 'float' },
            { title: "Profits ($ millions)", dataType: 'float' }
        ];
        obj.dataModel = { data: data };

        $("button#open_popup").button().click(function (evt) {
            $("#popup")            
            .dialog({
                height: 400,
                width: 700,
                //width: 'auto',
                modal: true,
                open: function (evt, ui) {   
                    $("#grid_popup").pqGrid(obj);
                },
                close: function () {
                    $("#grid_popup").pqGrid('destroy');
                },
                show: {
                    effect: "blind",
                    duration: 500
                }
            });
        }).click();
    });
        
</script>    
</head>
<body>

<div>
    <button type="button" id="open_popup">Open Popup</button>
</div>

<div title="Grid in Dialog" id="popup" style="overflow:hidden;">
    <div id="grid_popup"></div>
</div>

</body>

</html>
